package org.jeecg.modules.fund.controller;

import cn.hutool.core.date.DateUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.fund.entity.FundHold;
import org.jeecg.modules.fund.service.IFundCalendarCnService;
import org.jeecg.modules.fund.service.IFundTradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController
@Api(tags = "日期管理")
@RequestMapping("/sys/fund/calendarcn")
@Slf4j
public class FundCalendarCnController {
    @Autowired
    private IFundCalendarCnService calendarCnService;
    @Autowired
    private IFundTradeService tradeService;

    @RequestMapping(value = "/create", method = RequestMethod.POST)
    public Result<String> add() {
        calendarCnService.createDate();
        return Result.ok("创建成功");
    }

    @Deprecated
    @RequestMapping(value = "/date", method = RequestMethod.POST)
    public Result<String> date() {
        String date  = tradeService.createRealTradeDate(DateUtil.offsetDay(new Date(),1),0,"");
        return Result.ok(date);
    }
}
